<%@page import="java.util.List"%>
<%@page import="com.zhiyou.entities.UserUtilr"%>
<%@page import="com.zhiyou.util.UserUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
实现新增
<%
	request.setCharacterEncodingncoding("utf-8");
	response.setCharacterEncoding("utf-8");
	//1.改浏览器的编码
	//2.可以重新编码
	
	 String username=request.getParameter("username");
	 String n=new String(username.getBytes("iso-8859-1"),"utf-8");
	 System.out.println("name:  "+username);
	 String pwd=request.getParameter("pwd");
	 UserUtil util=new UserUtil();
	 int i= util.addUser(new User(username,pwd));
	 if(i>0){
		 List<User> list=util.getAllUsers();
			//把数据放到session中
			session.setAttribute("list", list);
		 //新增成功
		 response.sendRedirect("userList.jsp");
	 }else{
		 //失败
		 response.sendRedirect("error.jsp");
	 }
%>
</body>
</html>